home *** CD-ROM | disk | FTP | other *** search
- ;=======T=======T========================T==========================================;
- ;gms.s
- ;-----
- ;Compile this file and store it in SC:LIB/ if you have SAS/C.
- ;
- ;You can use it to take advantage of the multi-platform capabilities of GMS
- ;by linking your C programs with the following:
- ;
- ; 1> sc <source.c> link startup=LIB:gms.o data=far
-
- INCDIR "INCLUDES:"
- INCLUDE "games/games_lib.i"
-
- CALL MACRO
- jsr _LVO\1(a6)
- ENDM
-
- xdef _GMSBase
-
- xref _main
- xref _PREFSNAME
-
- SECTION IceAssembler,CODE ;SECTION __MERGED,CODE
-
- ;===================================================================================;
- ; SPECIAL STARTUP CODE
- ;===================================================================================;
-
- Start: MOVEM.L D0-D7/A0-A6,-(SP)
- cmp.l #"GMSP",d0
- beq.s .StartFromGMS
- .StartFromDOS
- move.l ($4).w,a6 ;a6 = ExecBase
- lea GMSName(pc),a1 ;a1 = Library name.
- moveq #$00,d0 ;d0 = Any version.
- jsr -552(a6) ;>> = OpenLibrary()
- move.l d0,_GMSBase ;ma = Save base.
- beq.s .errgms ;>> = Error, exit.
- move.l d0,a6 ;a6 = GMSBase.
- lea .exit(pc),a0 ;a0 = Pointer to SelfDestruct() cleanup.
- move.l a7,a1 ;a1 = Stack pointer.
- CALL InitDestruct ;>> = Initialise the call.
-
- move.l _PREFSNAME,a0
- CALL SetUserPrefs
- tst.l d0
- bne.s .exit
-
- jsr _main
-
- bra.s .exit
-
- .StartFromGMS
- move.l a1,_GMSBase
- move.l a1,a6 ;a6 = GMSBase.
- lea .exit(pc),a0 ;a0 = Pointer to SelfDestruct() cleanup.
- move.l a7,a1 ;a1 = Stack pointer.
- CALL InitDestruct ;>> = Initialise the call.
-
- move.l _PREFSNAME,a0
- CALL SetUserPrefs
- tst.l d0
- bne.s .exit
-
- jsr _main
-
- .exit move.l _GMSBase(pc),a6
- CALL CloseGMS
- .errgms MOVEM.L (SP)+,D0-D7/A0-A6
- moveq #$00,d0
- rts
-
- _GMSBase dc.l 0
-
- GMSName dc.b "GMS:GPI/Master.GPI",0
- even
-
-